import * as layout from "./assets/js/layout.js";
import * as dom from "./assets/js/dom.js";
import * as db from "./assets/js/db.js";
import * as request from "./assets/js/request.js";
import * as account from "./assets/js/account.js";
let storage = window.localStorage;
var ENABLE_SERVER = 1;
var ENABLE_UPDATE = 1;
//TODO
function postUpdate(elementId, message) {
  console.log("update");
}
function wsdb_article_submit(elementId, message) {
  if (ENABLE_UPDATE) {
    xml2article(elementId, message, postUpdate);
  } else {
    xml2article(elementId, message, null);
  }
}
function wsdb_article(tableName) {
  request.post_sql_form_with_callback("/sql",
    "select * from '" + tableName + "';",
    'article', layout.xml2article);
}
function wsdb_nav_ul_callback(elementId, message) {
  layout.xml2nav_ul(elementId, message, wsdb_article);
}
window.onload = function() {
  layout.standard();
  if (storage.nowHref == "signUp") {
    account.sign_up_form("article");
  } else {
    account.sign_in_form("article");
  }
  if (ENABLE_SERVER) {
  } else {
  }
};
